package com.qh.physicsexperiment.domin;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.qh.physicsexperiment.utils.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;


@TableName("teacher")
@Data
@NoArgsConstructor  //空参构造方法
@AllArgsConstructor //全参构造方法
@Accessors(chain = true)//作用是使成员属性的set方法不再返回void，而是返回对象本身，从而实现链式赋值。
@EqualsAndHashCode(callSuper = true)//父类属性不参与equal
@ApiModel(value="Teacher对象", description="教师信息")
public class Teacher extends BaseEntity {

    /**
     * 教师编号
     * 主键
     */
    @ApiModelProperty(value = "教师账号",notes = "自增id",required = true,dataType = "Long",allowableValues = "4")
    @NotBlank(message = "账号不能为空")
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 教师姓名
     */
    @ApiModelProperty(value = "教师姓名",dataType = "String")
    private String name;

    /**
     * 教师电话
     */
    @ApiModelProperty(value = "教师电话 11位",dataType = "String")
    @Pattern(regexp = "^1[3-9]\\d{9}$",message = "手机号不对")
    private String tel;

    /**
     * 教师密码
     */
    @ApiModelProperty(value = "教师密码",notes = "默认值123456",required = true,dataType = "String",allowableValues = "80")
    @NotBlank(message = "密码不能为空")
    @TableField(value = "password",select = false)
    private String pwd;

    //反序列化唯一标识？没看懂
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

}
